package com.myhome.controller;

import com.myhome.config.constant.R;
import com.myhome.domain.LoginResult;
import com.myhome.service.SysUserLoginService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author QYiXin
 * @Date 2021 10 09 17 39
 **/
@RestController
public class SysUserLoginController {
    @Autowired
    SysUserLoginService sysUserLoginService;
    @PostMapping("/login")
    @ApiOperation("用户登录")
    @ApiImplicitParams(
            {
                    @ApiImplicitParam(name = "username", value = "用户名"),
                    @ApiImplicitParam(name = "password", value = "用户密码")
            }
    )
    public R<LoginResult> adminLogin(String username, String password) {
        LoginResult result = sysUserLoginService.userLogin(username,password);
        return R.ok(result);
    }
}
